﻿module Streams

open System.IO
open Sources

let CreateStream(source : string) =      
   use input = new MemoryStream()
   use writer = new StreamWriter(input)      
      
   writer.Write(source)      
   writer.Flush()
      
   let output = new MemoryStream()
   
   input.Position <- 0L   
   input.CopyTo(output)

   output.Position <- 0L
   output

let CreateReader(stream : Stream) = 
   new SourceReader(stream)